package cn.ruanyun.backInterface.modules.base.mapper.mapper;


import cn.ruanyun.backInterface.modules.base.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author fei
 */
@Repository
public interface UserMapper extends BaseMapper<User> {

    @Select("select id from t_user where invitation_code = #{code}")
    String getIdByInvitationCode(@Param("code") String code);

    @Select("select * from t_user where id =#{createBy}")
    User getUserByCreateBy(@Param("createBy") String createBy);

    //hu 根據角色id獲取用戶信息
    List<User> getUserByRoleId(Map<String,Object> map);

    @Select("select count(1) from t_user_role where user_id = #{id} and role_id = '496138616573953' and del_flag = 0")
    Integer getCommonRoleNumById(@Param("id") String id);
}
